<jsp:include page="../template/top.jsp"></jsp:include>

<div class="interfaceExterna">
	<h3>
		<a href="#">Gr&aacute;ficos</a>
	</h3>
	<div id="chart_div">
	</div>
</div>

<br/>

<div class="interfaceExterna">
	<h3>
		<a href="#">Evolu&ccedil;&atilde;o do Faturamento</a>
	</h3>
	<div>
		<table style="float:left;">
			<thead>
				<tr>
					<th width="300px" align="left">Mes</th>
					<th width="300px" align="left">Faturamento</th>
				</tr>
			</thead>

			<tbody>
				<tr>
					<td width="300px" align="left" id="umMesAtras">${umMesAtras}</td>
					<td width="300px" align="left" id="faturamentoUmMesAtras"><fmt:formatNumber currencySymbol="R$ " type="currency" value="${faturamentoUmMesAtras}"></fmt:formatNumber></td>
				</tr>
				
				<tr>
					<td width="300px" align="left" id="doisMesesAtras">${doisMesesAtras}</td>
					<td width="300px" align="left" id="faturamentoDoisMesesAtras"><fmt:formatNumber currencySymbol="R$ " type="currency" value="${faturamentoDoisMesesAtras}"></fmt:formatNumber></td>
				</tr>
					
				<tr>
					<td width="300px" align="left" id="tresMesesAtras">${tresMesesAtras}</td>
					<td width="300px" align="left" id="faturamentoTresMesesAtras"><fmt:formatNumber currencySymbol="R$ " type="currency" value="${faturamentoTresMesesAtras}"></fmt:formatNumber></td>
				</tr>
			</tbody>
		</table>
	</div>
</div>

<br>

<jsp:include page="../template/bottom.jsp"></jsp:include>

<script type="text/javascript">

	google.load('visualization', '1', {packages:['corechart']});
	google.setOnLoadCallback(drawChart);

	function drawChart() {
		debugger;
		var data = new google.visualization.DataTable();
 		data.addColumn('string', 'Mes');
 		data.addColumn('number', 'Faturamento');
 		data.addRows(3);
 		
 		data.setValue(0, 0, $('#umMesAtras').html());
        data.setValue(0, 1, ${faturamentoUmMesAtras});

        data.setValue(1, 0, $('#doisMesesAtras').html());
        data.setValue(1, 1, ${faturamentoDoisMesesAtras});
        
        data.setValue(2, 0, $('#tresMesesAtras').html());
        data.setValue(2, 1, ${faturamentoTresMesesAtras});
		

		var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
		chart.draw(data, {width: 600, height: 340, title: 'Faturamento',
            vAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
        });
	}
</script>